Skip to content

fix(kas-container): preserve quoting in --runtime-args values - #188

Open
linzhp wants to merge 1 commit into
siemens:masterfrom
linzhp:runtime-args-quoting
Open

fix(kas-container): preserve quoting in --runtime-args values#188
linzhp wants to merge 1 commit into
siemens:masterfrom
linzhp:runtime-args-quoting

Conversation

@linzhp

@linzhp linzhp commented Aug 2, 2026

Copy link
Copy Markdown

The accumulated --runtime-args string is expanded unquoted, so it is word-split without honoring any quoting inside it. This makes it impossible to pass runtime arguments whose values contain spaces, e.g.

  kas-container --runtime-args "--device-cgroup-rule 'b 7:* rmw'" ...

which the engine receives as the four arguments "--device-cgroup-rule", "'b", "7:*" and "rmw'".

Expand KAS_EXTRA_RUNTIME_ARGS through eval instead, so shell quoting inside the user-supplied string survives and such values reach the container engine intact. Space-separated flags without quoting behave as before, and repeated --runtime-args usage still accumulates. Only the user-supplied string is eval'd; the internal argument lists keep the plain word-splitting expansion.

The accumulated --runtime-args string is expanded unquoted, so it is
word-split without honoring any quoting inside it. This makes it
impossible to pass runtime arguments whose values contain spaces, e.g.

  kas-container --runtime-args "--device-cgroup-rule 'b 7:* rmw'" ...

which the engine receives as the four arguments "--device-cgroup-rule",
"'b", "7:*" and "rmw'".

Expand KAS_EXTRA_RUNTIME_ARGS through eval instead, so shell quoting
inside the user-supplied string survives and such values reach the
container engine intact. Space-separated flags without quoting behave
as before, and repeated --runtime-args usage still accumulates. Only
the user-supplied string is eval'd; the internal argument lists keep
the plain word-splitting expansion.

Signed-off-by: Zhongpeng Lin <zplin@uber.com>

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jan-kiszka

Copy link
Copy Markdown
Collaborator

Thanks for this patch! Would you mind sending it to the mailing list as well (see https://github.com/siemens/kas/blob/master/CONTRIBUTING.md)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants